<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="reader.action?methodName=toAddReader" method="post">
		<table style="margin-bottom: 35px" class="querytable">
			<tr>
				<th class="textright">读者姓名：</th>
				<td class="textleft">
					<input type="text" name="readername">
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					<input type="button" value="查看读者信息">
				</td>
			</tr>
		</table>
		<table class="querytable">
			<tr>
				<th>读者姓名</th>
				<th>读者昵称</th>
				<th>联系方式</th>
				<th>注册时间</th>
				<th>操作</th>
			</tr>
			<c:choose>
				<c:when test="${empty rlist }">
					<tr>
						<td colspan="5" align="center" style="color: red">
							<b>对不起，没有查询到相关记录！</b>
						</td>
					</tr>
				</c:when>
				<c:otherwise>
					<c:forEach items="${rlist }" var="reade">
						<tr>
							<td>${reade.readername }</td>
							<td>${reade.nikename }</td>
							<td>${reade.phone }</td>
							<td>${reade.jointime }</td>
							<td>
								<a href="reader.action?methodName=detailReader&detailOrUpdate=detail&readerid=${reade.readerid}">查看</a>
								<a href="reader.action?methodName=toUpdateReader&detailOrUpdate=update&readerid=${reade.readerid}">修改</a>
								<a href="reader.action?methodName=doDeleteReader&readerid=${reade.readerid}" onclick="return confirm('确认删除读者信息吗?');">删除</a>
							</td>
						</tr>
					
					</c:forEach>
				</c:otherwise>
			</c:choose>
			<tr>
				<td colspan="5" align="center">
					<input type="submit" value="新增读者信息">
				</td>
			</tr>
		</table>
	</form>

<script type="text/javascript" src="${pageContext.request.contextPath }/webjars/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/listTable.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/editTablestyles.css">
</body>
<script type="text/javascript">
$(function() {
	$("input[type='button']").click(function() {
		$("form").attr("action","reader.action?methodName=doListReader").submit();
	});
});

</script>
</html>